package demo3;

/**
 * @Author 12629
 * @Description：
 */
public class Computer {

    public void powerOn() {
        System.out.println("电脑开机...");
    }

    public void powerOff() {
        System.out.println("电脑关机...");
    }

    public void usbService(IUSB iusb) {
        iusb.openDevice();

        if(iusb instanceof Mouse) {
            Mouse mouse = (Mouse) iusb;
            mouse.click();
        }else if(iusb instanceof KeyBoard) {
            KeyBoard keyBoard = (KeyBoard)iusb;
            keyBoard.input();
        }

        iusb.closeDevice();
    }
}
